import request from '@/config/axios'

export interface TableInfoVO {
  tableName: string
  tableType: string
  tableCapacity: number
  tableLocation: string
  tableStatus: string
  activeQrcode: string
  reservationId: number
  tableNotes: string
}

export interface PageParam {
  pageNo: number
  pageSize: number
}

// 前端定义的餐桌分页请求参数接口，对应后端的 TableInfoPageReqVO 类
export interface TableInfoPageReqVO extends PageParam {
  tableName?: string
  tableType?: string
  tableCapacity?: number
  tableLocation?: string
  tableStatus?: string
  activeQrcode?: string
  reservationId?: number
  tableNotes?: string
  createTime?: [Date, Date]
}
// 查询餐桌列表
export const getTableInfoPage = async (params: TableInfoPageReqVO) => {
  return await request.get({ url: `/tables/table-info/page`, params })
}

// 查询餐桌详情
export const getTableInfo = async (id: number) => {
  return await request.get({ url: `/tables/table-info/get?id=` + id })
}

// 新增餐桌
export const createTableInfo = async (data: TableInfoVO) => {
  return await request.post({ url: `/tables/table-info/create`, data })
}

// 修改餐桌
export const updateTableInfo = async (data: TableInfoVO) => {
  return await request.put({ url: `/tables/table-info/update`, data })
}

// 删除餐桌
export const deleteTableInfo = async (id: number) => {
  return await request.delete({ url: `/tables/table-info/delete?id=` + id })
}

// 导出餐桌 Excel
export const exportTableInfo = async (params) => {
  return await request.download({ url: `/tables/table-info/export-excel`, params })
}
